vfs: use native separators for displayed error message
authorJyrki Gadinger <nilsding@nilsding.org>
Tue, 18 Feb 2025 08:49:09 +0000 (09:49 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Tue, 18 Feb 2025 09:24:08 +0000 (09:24 +0000)
i.e. `C:\Nextcloud` instead of `C:/Nextcloud`

Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>
src/common/vfs.cpp

index 2e84fb2fb93cbe98c9e7ac8e5bc19a068fb38324..61b82a5056a81af7a6d5cdfa07ba4fd6d8c6bd94 100644 (file)
@@ -71,16 +71,17 @@ Result<void, QString> Vfs::checkAvailability(const QString &path, Vfs::Mode mode
 #ifdef Q_OS_WIN
     if (mode == Mode::WindowsCfApi) {
         const auto info = QFileInfo(path);
+        const auto nativePath = QDir::toNativeSeparators(path);
         if (QDir(info.canonicalFilePath()).isRoot()) {
-            return tr("Please choose a different location. %1 is a drive. It doesn't support virtual files.").arg(path);
+            return tr("Please choose a different location. %1 is a drive. It doesn't support virtual files.").arg(nativePath);
         }
         if (const auto fileSystemForPath = FileSystem::fileSystemForPath(info.absoluteFilePath());
             fileSystemForPath != QLatin1String("NTFS")) {
-            return tr("Please choose a different location. %1 isn't a NTFS file system. It doesn't support virtual files.").arg(path);
+            return tr("Please choose a different location. %1 isn't a NTFS file system. It doesn't support virtual files.").arg(nativePath);
         }
         const auto type = GetDriveTypeW(reinterpret_cast<const wchar_t *>(QDir::toNativeSeparators(info.absoluteFilePath().mid(0, 3)).utf16()));
         if (type == DRIVE_REMOTE) {
-            return tr("Please choose a different location. %1 is a network drive. It doesn't support virtual files.").arg(path);
+            return tr("Please choose a different location. %1 is a network drive. It doesn't support virtual files.").arg(nativePath);
         }
     }
 #else